package com.ruoyi.web.controller.datastatistics;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.datastatistics.service.IBigScreenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * 新大屏数据展示
 * @author zt
 * @date 2025-05-27
 */
@RestController
@RequestMapping("/bigscreen/data")
public class BigScreenController extends BaseController
{

    @Autowired
    private IBigScreenService bigScreenService;

    /**
    * @Description: 年度能源（电，水，气，热）累计用量汇总
    * @date: 2025/6/6 09:46
    * @author: zt
    */
    @GetMapping("/getEnergyYearData")
    public AjaxResult getEnergyYearData(){
        String tenantId = this.getLoginUser().getTenantId();
        return AjaxResult.success(bigScreenService.getEnergyYearData(tenantId));
    }
    
    /**
    * @Description: 上月与上上月各类能源的费用情况
    * @date: 2025/6/6 09:46
    * @author: zt
    */
    @GetMapping("/getEnergyCostData")
    public AjaxResult getEnergyCostData(){
        String tenantId = this.getLoginUser().getTenantId();
        return AjaxResult.success(bigScreenService.getEnergyCostData(tenantId));
    }

    /**
    * @Description: 各类能源类型的采集设备统计
    * @date: 2025/6/6 09:46
    * @author: zt
    */
    @GetMapping("/getEnergyDeviceCountData")
    public AjaxResult getEnergyDeviceCountData(){
        String tenantId = this.getLoginUser().getTenantId();
        return AjaxResult.success(bigScreenService.getEnergyDeviceCountData(tenantId));
    }

    /**
    * @Description: 租户用量排名
    * @date: 2025/6/6 09:46
    * @author: zt
    */
    @GetMapping("/getEnergyUseRankData")
    public AjaxResult getEnergyUseRankData(Integer energyType){
        String tenantId = this.getLoginUser().getTenantId();
        return AjaxResult.success(bigScreenService.getEnergyUseRankData(tenantId,energyType));
    }

    /**
     * @Description: 各能源年用量统计
     * @date: 2025/6/6 09:46
     * @author: zt
     */
    @GetMapping("/getEnergyYearUseData")
    public AjaxResult getEnergyYearUseData(){
        String tenantId = this.getLoginUser().getTenantId();
        return AjaxResult.success(bigScreenService.getEnergyYearUseData(tenantId));
    }

    /**
     * @Description: 各能源分项统计
     * @date: 2025/6/6 09:46
     * @author: zt
     */
    @GetMapping("/getEnergyItemData")
    public AjaxResult getEnergyItemData(Integer energyType){
        String tenantId = this.getLoginUser().getTenantId();
        return AjaxResult.success(bigScreenService.getEnergyItemData(tenantId,energyType));
    }

    /**
     * @Description: 报警信息-近7天
     * @date: 2025/6/6 09:46
     * @author: zt
     */
    @GetMapping("/getEnergyWarnData")
    public AjaxResult getEnergyWarnData(){
        String tenantId = this.getLoginUser().getTenantId();
        return AjaxResult.success(bigScreenService.getEnergyWarnData(tenantId));
    }

    /**
    * @Description: 获取地图上区域信息
    * @date: 2025/6/20 11:21
    * @author: zt
    */
    @GetMapping("/getAreaPointInMap")
    public AjaxResult getAreaPointInMap(Integer energyType){
        String tenantId = this.getLoginUser().getTenantId();
        return AjaxResult.success(bigScreenService.getAreaPointInMap(tenantId,energyType));
    }

}
